package com.ruoyi.decision.service.impl;

import com.ruoyi.decision.domain.SchemeClassification;
import com.ruoyi.decision.mapper.SchemeClassificationMapper;
import com.ruoyi.decision.service.ISchemeClassificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Locale;
import java.util.UUID;

/**
 * 方案库分类Service业务层处理
 * 
 * @author zbw
 * @date 2022-07-20
 */
@Service
public class SchemeClassificationServiceImpl implements ISchemeClassificationService 
{
    @Autowired
    private SchemeClassificationMapper schemeClassificationMapper;

    /**
     * 查询方案库分类
     * 
     * @param templatetypeid 方案库分类主键
     * @return 方案库分类
     */
    @Override
    public SchemeClassification selectSchemeClassificationByTemplatetypeid(String templatetypeid)
    {
        return schemeClassificationMapper.selectSchemeClassificationByTemplatetypeid(templatetypeid);
    }

    /**
     * 查询方案库分类列表
     * 
     * @param schemeClassification 方案库分类
     * @return 方案库分类
     */
    @Override
    public List<SchemeClassification> selectSchemeClassificationList(SchemeClassification schemeClassification)
    {
        return schemeClassificationMapper.selectSchemeClassificationList(schemeClassification);
    }

    /**
     * 新增方案库分类
     * 
     * @param schemeClassification 方案库分类
     * @return 结果
     */
    @Override
    public int insertSchemeClassification(SchemeClassification schemeClassification)
    {
        String templatetypeid = UUID.randomUUID().toString().toLowerCase(Locale.ROOT).replace("-","");
        schemeClassification.setTemplatetypeid(templatetypeid);
        return schemeClassificationMapper.insertSchemeClassification(schemeClassification);
    }

    /**
     * 修改方案库分类
     * 
     * @param schemeClassification 方案库分类
     * @return 结果
     */
    @Override
    public int updateSchemeClassification(SchemeClassification schemeClassification)
    {
        return schemeClassificationMapper.updateSchemeClassification(schemeClassification);
    }

    /**
     * 批量删除方案库分类
     * 
     * @param templatetypeids 需要删除的方案库分类主键
     * @return 结果
     */
    @Override
    public int deleteSchemeClassificationByTemplatetypeids(String[] templatetypeids)
    {
        return schemeClassificationMapper.deleteSchemeClassificationByTemplatetypeids(templatetypeids);
    }

    /**
     * 删除方案库分类信息
     * 
     * @param templatetypeid 方案库分类主键
     * @return 结果
     */
    @Override
    public int deleteSchemeClassificationByTemplatetypeid(String templatetypeid)
    {
        return schemeClassificationMapper.deleteSchemeClassificationByTemplatetypeid(templatetypeid);
    }
}
